<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
	href="static/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="static/easyui/themes/icon.css">

<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('#tree').tree({
			url:'tree/show',
			onClick : function(node) {
				// 先要判断当前这个选项卡存不存在select
				if ($('#tabs').tabs('exists', node.text)) {
					// 选中指定的选项卡
					$('#tabs').tabs('select', node.text);
				} else {
					if(node.attributes.url!=''){
						// 创建一个选项卡
						$('#tabs').tabs('add', {
							title : node.text,
							content:'<iframe frameborder=0 width=100% height=100% src='+node.attributes.url+'></iframe>',
							cache:false,
							closable : true,
							tools : [ {
								iconCls : 'icon-mini-refresh',
								handler : function() {
									console.debug('refresh tab!!');
									//alert('refresh');刷新
									//获取当前被选中的选项卡
									var tab = $('#tabs').tabs('getSelected');
									//tab.panel('refresh');
									tab.panel({content:'<iframe frameborder=0 width=100% height=100% src='+node.attributes.url+'></iframe>'});
								}
							}]
						});
					}
				}
			},
			onLoadSuccess:function(node,data){
				//收起所有菜单
				$('#tree').tree('collapseAll');
			}
		});
	});


</script>
</head>
<body class="easyui-layout">
	<div data-options="region:'north',title:'North Title',split:true"
		style="height: 150px;">欢迎：${asuser.username}</div>
	
	
	<div data-options="region:'west',title:'West',split:true"
		style="width: 200px;"><ul id="tree"></ul>  
		</div>
	<div data-options="region:'center',title:'center title'"
		style="padding: 5px; background: #eee;"></div>
</body>
</body>
</html>